
                                            Palette Editor

_________________________________________________________________________

Introduction
Before we explore the individual functions of the Palette Editor, we will discuss some general information about the color management used by EasyFractal.
The algorithms to calculate fractals usually return only a few hundred color values. It is thus advantageous to work with color palettes to be able to easily view the image in several colors. 
When calculating fractals, EasyFractal does not assign a concrete color to the individual pixels but only a color index. The palette determines which color is finally assigned to this point because the palette assigns an actual color to every index. To change the coloration of the image, just change the assigned palette but not the image itself. As shown below, this method offers many options of changing the coloration of an image.

_________________________________________________________________________

Structure 
The Palette Editor is located in a floating window as well. This window is always displayed in the foreground, above all other document windows so that you can always access the functions of the Palette Editor. The control elements are located in the upper section of the window, while the actual palette is displayed as a colored ribbon. 
Many functions of the Palette Editor affect an interval you specify with Start Color and End Color, displayed as a black bar above the colored ribbon.
The Palette Editor always shows the palette of the uppermost fractal window.

_________________________________________________________________________

Individual Functions 

Target
Use this group with three input fields to define a range of the palette to be affected by the functions discussed later. 

Start Color and End Color 
Here you enter the color number you use to specify a specific interval of your color palette, you later use with different functions (e.g., Color Gradient, Rotation, etc.). All colors of a color palette associated with the respective image have certain numbers allocated (indices) to them and are displayed in the color ribbon of the Palette Editor one after the other. 

Increment
Use this option to specify the increment rhythm of using a function. The value set here has an affect on the Rotation and Color Gradient. For example, the Color Gradient function results in a silvery color effect with the corresponding setting of the Increment if you use Increment 2 to cycle all even numbers from a light to a dark color and then all odd numbers from black to white. 

Palette Size
As previously mentioned, fractals usually contain only a few hundred different colors. To color a fractal, all you have to do is define a palette of the corresponding size. Usually, 256 entries are sufficient, special cases might require a higher figure. Less than 256 colors, however, are not permitted either. A general principle, however, is that the number of different colors in fractals is always smaller than the number you indicate for Iterations in the Fractal Editor.
If the applied palette contains fewer colors than appear in the picture, EasyFractal assigns the same color to different points. In these type of cases it might be more practical to enlarge the color palette to create more detailed image structures. The following example will illustrate this point: 
Load the picture named "Mandala" located in the "Fractals:2D-Fractals" folder. The outer area shows clear structures while the interior of the image shows only an unstructured pixel chaos. The reason for this is that the number of iterations (in this case 2048) is higher than the number of available colors. This means EasyFractal has to use the same color palette for the finely structured inner area than for the coarser outer part for which the palette is quite suitable. To remedy this, first enter 2048 for the palette size and then press the ENTER or RETURN key. The picture is now black since all additional palette entries are set to black and the color indices from 0 to 255 do not exist in the image at all. Now enter a 0 for Start Color and 2046 for End Color. Then rotate the palette towards the right until the image is colored and the outer area is not yet black (approx. 430 steps). Move the slider bar within the Palette Editor to the right until the end of the colored sections is visible. Now click on Start Color and then use the mouse to click on the first black shade at the end of the palette (approx. 685). Now click on Start Color and set the starting color to a white shade by loading the color picker with Change Color. All that is left to do is to click on Color Gradient and a black Mandelbrot's Fractal surrounded by a white halo now appears inside of the picture instead of the initial colored single pixels. 


Expansion
Starting with EasyFractal 3.0 it is possible to apply a fine structure to the monochrome areas of a fractal (see also the Fractal Editor function with the same name). The associated much finer division of the otherwise monochrome areas requires palettes with thousands or even tens of thousands of colors to achieve an optimal coloration of the fractal. Generating such large palettes is very time consuming and tedious work. This the reason we implemented the Expansion function you can use to generate a large palette with thousands of colors from a small palette (e.g. with only 256 colors). This function generates two neighboring colors for each color of the original palette while creating a color progression between the original color and its two neighboring colors. The expansion parameter determines the number of intermediate colors. For example, setting this value to 2 adds two additional colors to the original color so that the expanded palette now consists of (4+1)*256 =1536 colors. The following formula usually applies:

Colors after expansion = (expansion rate + 1) * number of original colors.

The resulting color ribbon oscillates between light and dark tones. Such a palette is especially well suited for fractals with a Fine Structure because they appear very 3-D due to the dark/light progressions. The settings for Expansion and Fine Structure should match in general. However, there is no reason why you cannot experiment with different values for special effects.


Undo
Should you make a mistake when editing the palette, use this function to undo the last operation. EasyFractal supports an undo depth of up to 64 operations or steps. Click on this button several times to step-by-step undo up to 64 changes you made to the palette. This command is identical with the menu item of the palette menu with the same name.



The Editing Functions of the Palette Editor

The actual editing functions are located in the right section of the Palette Editor. These functions are grouped and accessible by clicking on one of the three tabs representing these three groups.


General

This group contains general functions to select color indexes and change colors.









Change Color
Opens the color picker dialog box. Use the color picker to easily select a color in different color spaces. Close the dialog box with OK and either the Start Color or the End Color is set to the new color, depending on which radio button is activated. 

Pick Color
Select this button to load the eyedropper (or pipette) cursor. Use this tool to pick a color from anywhere on the entire desktop, e.g., menu bar, fractal image, or desktop background. 
Just one mouse click and the selected color is added to the color ribbon of the Palette Editor as a thin, vertical line and to the small colored box of the Start Color or End Color.
The function can be canceled by pressing the right mouse button or the command key together with the left mouse button. 

Color Gradient
Use this function to specify a color gradient using the interval defined in Start Color and End Color of your color palette. This creates interesting effects especially in combination with the increment size. Here is an example to illustrate this point: Click into the window with the traditional Mandelbrot's Fractal as opened automatically after program start. 

- First, deactivate the fine structure by selecting the FS tab in the Fractal Editor and then clicking on Fine Structure.
-Use the color picker tool (Change Color) to generate the colors of the example.

Example of Color Gradient with Increment 2:

1. Color Gradient:
Start Color No. 0 = Dark Green
End Color No. 254 = White
Increment = 2 
Click on Color Gradient.

2. Color Gradient:
Start Color No. 1 = Light Yellow
End Color No. 255= Black
Increment = 2 
Again click on Color Gradient. 

If you now zoom into the picture you will see that the structures look much more three-dimensional due to the alternating light and dark colors, almost like the infinitely forked roots of a tree. Of course, you can also reactivate the Fine Structure for additional effects. 

This example illustrates that it is best to make color changes to the non-expanding palettes since the color quantity is here still manageable. Just reactivate the Fine Structure setting again after editing the palette.

Pick Index
Use Pick Index to determine a color number.The cursor changes into an eyedropper as soon as you move the mouse across the color ribbon. Click with the mouse to automatically add the selected color number to the currently active number field (Start Color or End Color). You can also use this method to index a color number from a fractal image. Just click into the desired image and select a color using the eyedropper cursor. The color you selected with Pick Index is displayed in the Palette Editor to the right of the color number field and the small arrow keys. Use these arrow keys to set a color number as well. Or enter the color number directly into the color number field. Remember, you cannot enter any high color number because the number depends on the loaded color palette or your loaded fractal image. The number of possible colors is indicated at the bottom in the field for the palette size. 
This function is very helpful if you want to assign suitable color gradients to specific sections of a fractal because you can use this function to directly pick the required start and end colors from the picture. 
Click the button again to deactivate the function. 

Default Values
The target settings as well as the rotation value are set to the default values.

Default Palette
Loads the default palette, the same as the one used for the Mandelbrot's Fractal," loaded automatically after program start. 


Effects

Use this function to rotate, invert, and switch palette to monochrome or exchange blue, red, and green fractions.

Two radio buttons to specify the target of the operation as well as a checkbox are located in the upper area.

All
Activating this setting has the effect that all functions in this group apply to the entire palette.

Target
This button has the effect that only colors defined as target using Start Color, End Color, and Increment are affected.

With Default Increment
After expanding a palette, it is best to use a rotation value that corresponds with the wave length of the expanded palette.

Wave length = 2 * Expansion + 1

Activate this checkbox to save yourself this extra calculation work. Rotation increments are always executed in complete wave lengths regardless of the target settings.
This checkbox also affects the other functions. Here, the increment is one if With recommended increment is activated.

Rotation
Use Rotation to determine the ideal setting of a color palette for a fractal. The picture continuously changes by slowly cycling the colors. With Rotation, just click on one of the two small arrows and keep the mouse button depressed. You will see the colors of the current palette being cycled, something that can lead to very interesting optical effects with some pictures. If your entire color palette is to be considered, you have to set the Start Color to 0 and the End Color to the highest color number of your palette or just click on All.
It is also possible to cycle through smaller palette intervals without moving the other colors. Just indicate a corresponding interval for Start Color and End Color.
Another option of manipulating the rotation is to set the Increment to a value such as 2. Colors are then rotated by 2 numbers. Just try out for yourself which settings are interesting for your picture.

Invert Colors
All colors of the selected interval are inverted, i.e., they are replaced by their complimentary colors. Click on this button again to undo the changes. 

Monochrome
All colors in the selected interval are replaced by the corresponding grey tones. Click on this button again to undo the changes. 

R<>G, R<>B, G<>B
These three buttons exchange the color component within the palette. R<>G exchanges the red with the green components, R<>B the red with the blue components, and G<>B the green with the blue components. All three buttons affect only the selected interval.


Color

The third group in the Palette Editor pertains to Brightness and Contrast..

Two radio buttons to specify the target of the operation as well as a button to Fix changes are located in the upper area. 
The Brightness and Contrast functions actually work virtually, which means the palette itself is not changed at all. A mathematical function is applied to the palette when it is displayed on screen; this mathematical function converts Brightness or Contrast according to the settings. This is significant because it means that all changes are completely reversible since the original palette remains intact. The change is not applied to the palette until you click on Fix and even then can you use the Undo function to undo the operation.

All
Activating this setting has the effect that all functions in this group apply to the entire palette.

Target
This button has the effect that only colors defined as target using Start Color, End Color, and Increment are affected.

Fix
Use this button to fix the Brightness and Contrast changes made to the palette. The settings for Brightness and Contrast are automatically set to zero since this actually replaces the original palette with the changed palette. Use the Undo function to restore the old palette.

Brightness
This group includes three adjustment controls for the brightness of the primary colors Red, Green, and Blue, as well as a white control that changes all colors evenly. The scale ranges from -50 (dark) to +50 (bright).

Contrast
This group includes three adjustment controls for the contrasts of the primary colors Red, Green, and Blue, as well as a white control that changes all colors evenly. The scale ranges from -50 (low contrast) to +50 (high contrast).
